import requests
class IhrmEmpMangeApi:
    # 添加员工
    @classmethod
    def add_emp(cls, token, body):
        url = "http://ihrm2-test.itheima.net/api/sys/user"
        header = {"Content-Type": "application/json", "Authorization": token}
        resp = requests.post(url=url, headers=header, json=body)
        return resp
    # 查询员工
    @classmethod
    def query_emp(cls, token, emp_id):
        url = "http://ihrm2-test.itheima.net/api/sys/user/" + emp_id
        header = {"Authorization": token}
        resp = requests.get(url=url, headers=header)
        return resp
    # 修改员工
    @classmethod
    def modify_emp(cls, token, body, emp_id):
        url = "http://ihrm2-test.itheima.net/api/sys/user/" + emp_id
        header = {"Content-Type": "application/json", "Authorization": token}
        resp = requests.put(url=url, headers=header, json=body)
        return resp
    # 删除员工
    @classmethod
    def delete_emp(cls, token, emp_id):
        url = "http://ihrm2-test.itheima.net/api/sys/user/" + emp_id
        header = {"Authorization": token}
        resp = requests.delete(url=url, headers=header)
        return resp
